<?php
session_start();
require_once '../header.php';
$webroot="../";
require_once '../html/admintemplate.php';
function __autoload($className)
{
	require_once('../class/' . $className . '.class.php');
}
session::need_manage();
if(!empty($_POST)&&(session::is_manager()==TRUE))
{
	$post=$_POST;
	print_r($post);
	$verify=rtrim(trim($post['password']));
	$verify=md5($verify);
	if($verify=='de753ecc068fbd9e495d5f115b2bef3a')
	{
		$userid=session::getuserid();
		$username=username::getUsernameFromUserid($userid);
		$news=$post['news'];
		$insert=database::Insert("news", array(
		'news' => $news,
		'userupdate' => $username
		));
		if($insert)
		{
			echo "update news successful";
		}
		else
		{
			echo "erro in update status";
		}
	}
	else
	{
		echo "sai pass";
	}
}
else
{
	require_once '../html/AddNews2DB.php';
}
?>